package network;

/**
 *
 * @author Mariam
 */
public interface RemoteApp {

    /**
     * Handles the reception of a bye message
     *
     * @param username the login of the receiver (remote user)
     */
    void byeRcvd(String username);

    /**
     * Handles the reception of a file answer
     *
     * @param username the login of the receiver (remote user)
     * @param filename
     * @param accepted
     */
    void fileAnswerRcvd(String username, String filename, boolean accepted);

    /**
     * Handles the reception of a file request
     *
     * @param username the login of the receiver (remote user)
     * @param filename the name of the file the remote user wants to send
     * @param size the size of the file
     */
    void fileRequestRcvd(String username, String filename, long size);

    /**
     * Handles the reception of a hello message
     *
     * @param username the login of the receiver (remote user)
     * @param hostname the name of the the remote user's machine
     */
    void helloRcvd(String username, String hostname);

    /**
     * Handles the reception of a text message
     *
     * @param username the login of the receiver (remote user)
     * @param msg the text message that has been received
     */
    void msgRcvd(String username, String msg);

    /**
     * Starts the thread of reception in UDP to listen to incoming messages
     */
    void receive();

    /**
     * Start the thread of reception in TCP to retrieve the file sent by a
     * remote user
     *
     * @param filename the name of the file previously indicated in the file
     * request
     * @param filepath the final destination where the file will be saved
     */
    void receiveFile(String filename, String filepath);

    /**
     * Sends a bye message in broadcast to informs other remote connected users
     * about the disconnection of the local user
     */
    void sendBye();

    /**
     * Sends the file to the remote user
     *
     * @param username the login of the receiver (remote user)
     * @param filepath the path where is located the file to send
     */
    void sendFile(String username, String filepath);

    /**
     * Sends the local user's reply to a file request sent by a remote user
     *
     * @param username the login of the receiver (remote user)
     * @param filename the name of the file the remote user has proposed to send
     * to the local user
     * @param accepted the choice of the local user : if true he wants to
     * download the file and waits for the sending, if false he refuses the
     * sending of the file
     * @param size the size of the file
     */
    void sendFileAnswer(String username, String filename, boolean accepted, long size);

    /**
     * Sends a request message to ask the remote user if he wants to download a
     * file sent be the local user
     *
     * @param username the login of the receiver (remote user)
     * @param filename the name of the file the local user wants to send
     * @param size the size of the file
     */
    void sendFileRequest(String username, String filename, long size);

    /**
     * Sends a broadcast hello message to all of the connected users to announce
     * the arrival (connection) of the local user
     *
     * @param username the login of the local user
     */
    void sendHello(String username);

    /**
     * Sends a hello back to acknowledge the hello lessage sent by the remote
     * user and to inform him about the presence of the local user
     *
     * @param remoteUsername the login of the remote user who has sent a hello
     * message to the local user
     */
    void sendHelloAck(String remoteUsername);

    /**
     * Sends a text message to a remote user
     *
     * @param username the login of the receiver (remote user)
     * @param msgToSend the message that has been typed by the local user
     */
    void sendMsg(String username, String msgToSend);
    
}
